package com.message.Volcengine_ai_API.VolcengineConfig;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class Volcengineconfig implements WebMvcConfigurer {
    @Value("${external.resource.dir}")
    private String uploadPath;
    @Bean
public RestTemplate restTemplate(RestTemplateBuilder builder) {
    return builder.build();
}

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // 添加静态资源映射路径
        registry.addResourceHandler("/external-resources/**")
                .addResourceLocations("file:" + uploadPath + "/");
    }
}

